using System.Globalization;
using System.Xml.Serialization;

namespace HengTong.Kingdee.WSWMSImportBillFacadeSrvProxyService
{
    /// <summary>
    /// EAS 库位数据信息
    /// </summary>
    [XmlRoot("DataInfo")]
    public class EasLocationDataInfo
    {
        [XmlElement("DataHead")]
        public EasLocationDataHead DataHead { get; set; }
    }

    /// <summary>
    /// EAS 库位数据头
    /// </summary>
    public class EasLocationDataHead
    {
        /// <summary>
        /// 创建时间（原始字符串）
        /// </summary>
        [XmlElement("createTime")]
        public string CreateTimeString { get; set; }

        /// <summary>
        /// 创建时间（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? CreateTime
        {
            get
            {
                if (string.IsNullOrWhiteSpace(CreateTimeString))
                    return null;
                if (DateTime.TryParseExact(CreateTimeString, "yyyy-MM-dd HH:mm:ss",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 简称
        /// </summary>
        [XmlElement("simpleName")]
        public string SimpleName { get; set; }

        /// <summary>
        /// 仓库
        /// </summary>
        [XmlElement("Warehouse")]
        public string Warehouse { get; set; }

        /// <summary>
        /// 控制单元
        /// </summary>
        [XmlElement("CU")]
        public string CU { get; set; }

        /// <summary>
        /// 最后更新时间（原始字符串）
        /// </summary>
        [XmlElement("lastUpdateTime")]
        public string LastUpdateTimeString { get; set; }

        /// <summary>
        /// 最后更新时间（DateTime 类型）
        /// </summary>
        [XmlIgnore]
        public DateTime? LastUpdateTime
        {
            get
            {
                if (string.IsNullOrWhiteSpace(LastUpdateTimeString))
                    return null;
                if (DateTime.TryParseExact(LastUpdateTimeString, "yyyy-MM-dd HH:mm:ss",
                    CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
                    return result;
                return null;
            }
        }

        /// <summary>
        /// 最后更新用户
        /// </summary>
        [XmlElement("lastUpdateUser")]
        public string LastUpdateUser { get; set; }

        /// <summary>
        /// 编号
        /// </summary>
        [XmlElement("number")]
        public string Number { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [XmlElement("creator")]
        public string Creator { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        [XmlElement("State")]
        public string State { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [XmlElement("description")]
        public string Description { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        [XmlElement("name")]
        public string Name { get; set; }

        /// <summary>
        /// 传输状态
        /// </summary>
        [XmlElement("TransState")]
        public string TransState { get; set; }

        /// <summary>
        /// 库位组
        /// </summary>
        [XmlElement("locationGroup")]
        public string LocationGroup { get; set; }
    }
}

